Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements lazy loading for extensions to improve application startup performance. Instead of loading all extensions when the app launches, they are now registered for deferred loading and only initialized when actually needed (when tools are first requested).
Key Changes
- Frontend no longer pre-loads extensions on app startup - extensions load lazily when the user begins interacting
- Backend registers extensions on agent resume without immediately connecting to MCP servers
- Extensions are automatically loaded on first tool request via
get_prefixed_tools
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui/desktop/src/App.tsx | Removes eager extension loading on app startup; removes unused imports and state setters |
| crates/goose/src/agents/extension_manager.rs | Adds lazy loading infrastructure with pending_configs field and register_extension/ensure_pending_extensions_loaded methods |
| crates/goose/src/agents/agent.rs | Adds register_extension method that handles frontend tools immediately and defers MCP extensions |
| crates/goose-server/src/routes/agent.rs | Replaces eager add_extension calls with lazy register_extension calls in resume_agent |
| let config_name = config.key().to_string(); | ||
| let sanitized_name = normalize(config_name); | ||
|
|
||
| // Skip if already loaded or already pending |
There was a problem hiding this comment.
The comment states "Skip if already loaded or already pending" but the code only checks if the extension is already loaded, not if it's already pending. The code works correctly because HashMap::insert overwrites duplicates and add_extension is idempotent, but the comment should be updated to match the implementation.
| // Skip if already loaded or already pending | |
| // Skip if the extension is already loaded |
|
Isn't this just going to make the response slower by however long it takes to load the extension? |
this is an alternative to: #6350
this attempts to only load extensions when they are needed (as in launch)